<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="applicable-device" content="mobile">
  <meta name="viewport"
    content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,user-scalable=no">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <meta name="msapplication-tap-highlight" content="no">
  <title>授权登录</title>
  <script src="../static/jquery.min.js"></script>

  <style>
    body {
      background: #f5f5f5;
    }

    .loader-base {
      background-color: rgba(0, 0, 0, 0.3);
      width: 100vw;
      height: 100vh;
      position: fixed;
      top: 0;
      left: 0;
      z-index: 19820710;
    }

    .loader-wrap {
      color: #ffffff;
      font-size: 45px;
      overflow: hidden;
      width: 1em;
      height: 1em;
      border-radius: 50%;
      position: fixed;
      top: 50%;
      left: 50%;
      margin: -0.5em 0 0 -0.5em;
      -ms-transform: translateZ(0);
      -webkit-animation: load6 1.7s infinite ease;
      animation: load6 1.7s infinite ease;
      z-index: 19830610;
    }

    .loader-text {
      padding-top: 5em;
      margin: 0 auto;
      height: 100vh;
      line-height: 100vh;
      text-align: center;
      color: #fff;
    }

    .blink {
      animation: twinkling 1.7s infinite ease;
      -webkit-animation-duration: 1.7s;
      animation-duration: 1.7s;
      -webkit-animation-fill-mode: both;
      animation-fill-mode: both
    }

    @-webkit-keyframes twinkling {
      0% {
        opacity: 0.5;
      }

      50% {
        opacity: 1;
      }

      100% {
        opacity: 0.5;
      }
    }

    @keyframes twinkling {
      0% {
        opacity: 0.5;
      }

      50% {
        opacity: 1;
      }

      100% {
        opacity: 0.5;
      }
    }

    @-webkit-keyframes load6 {
      0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }

      5%,
      95% {
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }

      10%,
      59% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em;
      }

      20% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em;
      }

      38% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em;
      }

      100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }
    }

    @keyframes load6 {
      0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }

      5%,
      95% {
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }

      10%,
      59% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em;
      }

      20% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em;
      }

      38% {
        box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em;
      }

      100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
        box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em;
      }
    }
  </style>
</head>

<body>
  <div class="loader-base" id="loader">
    <div class="loader-wrap"></div>
    <div class="loader-text blink">
      授权中，请稍候
    </div>
  </div>
  <div id="codeField"></div>
  <div id="uniField"></div>
</body>

</html>
<script>
  $('#loader').show();
  let code = getQueryString('code');
  if(code) {
    let query = {
      code: code
    }
    $.post("http://llmk.csyaoly.com:3032/api/webchart/GetDingDingOpenID", query, function (res) {
      $('#loader').hide();
      if (res.IsSuccess) {
        if(!localStorage.getItem('DD_Data') || localStorage.getItem('DD_Data') == null || !localStorage.getItem('DD_Data') == '' || !localStorage.getItem('DD_Data') == undefined){
          let data = JSON.stringify(res.Data);
          localStorage.setItem('DD_Data', data);
        }
        location.href = "/#/DingPages/OAuth"
      } else {
        var err = res.ErrorMessage || '服务器连接失败';
        alert(err);
      }
    });
  }

  function getQueryString(name){
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
  };
</script>